#!/bin/bash

name="build"

if [ ! -z $1 ]; 
then
name=$1
fi

if [ $name = "gcc" ]
then
echo "now building the main"
gcc -g -Wall -o ./bin/Int_Tem ./src/main.c ./src/ITemp.c ./src/file.c ./src/led.c ./src/temperature.c ./src/lirc_out.c -I ./include -lwiringPi -lpthread
fi


if [ $name = "thread" ]
then
echo "now building the main"
fi

if [ $name = "arm" ]
then
echo "now building the main"
fi

if [ $name = "temperature" ]
then
echo "now building the ".$name
gcc -Wall -o ./bin/temperature ./src/temperature.c -I ./include -lwiringPi
chmod 777 ./bin/temperature
fi

if [ $name = "lirc_in" ]
then
echo "now building the ".$name
gcc -Wall -o ./bin/lirc_in ./src/lirc_in.c -I ./include -lbcm2835
chmod 777 ./bin/temperature
fi

if [ $name = "lirc_out" ]
then
echo "now building the ".$name
gcc -Wall -o ./bin/lirc_out ./src/lirc_out.c -I ./include 
chmod 777 ./bin/temperature
fi

if [ $name = "led" ]
then
echo "now building the ".$name
gcc -Wall -o ./bin/led ./src/led.c -I ./include -lwiringPi
chmod 777 ./bin/led
fi
#end
